<style type="text/css">
.fieldset {
         border: 1px solid #ccc;
         padding: 10px;
     }
</style>
<div class="container-fluid">
  <%= form_for @customer, :html => { :class => 'form-horizontal' } do |f| %>
  <legend><%= controller.action_name.capitalize %> customer</legend>
  <div class="row-fluid">
    <div class="span12">
      <fieldset class="fieldset">
      <h5>Customer details</h5>
      <div class="row-fluid">
        <div class="span6">
          <label>Name</label>
          <%= f.text_field :name, :class => 'span12' %>
        </div>
      </div>
      </fieldset>
      <br/>
      <!-- Default address -->
      <fieldset class="fieldset">
      <h5>Address details</h5>
      <%= fields_for @customer.default_address do |default_address| %>
        <%= default_address.hidden_field :id, :class => 'span12' %>
      <div class="row-fluid">
        <div class="span6">
          <label>Address 1</label>
          <%= default_address.text_area :address1, :rows => '3', :style => "width: 400px;" %>
        </div>
        <div class="span6">
          <label>Postal code</label>
          <%= default_address.text_field :postal_code, :class => 'span12' %>
        </div>
      </div>    
      <div class="row-fluid">
        <div class="span6">
          <label>City</label>
          <%= default_address.select :city_id, options_from_collection_for_select(City.all, :id, :name), {}, :class => 'span12' %>
        </div>
        <div class="span6">
          <label>State</label>
          <%= default_address.select :state_id, options_from_collection_for_select(State.all, :id, :name), {}, :class => 'span12' %>
        </div>
      </div>  
      <% end %>
      </fieldset>
      <br/>
      <!-- Default contact -->
      <fieldset class="fieldset">
      <h5>Contact details</h5>
      <%= fields_for @customer.default_contact do |default_contact| %>
        <%= default_contact.hidden_field :id, :class => 'span12' %>
      <div class="row-fluid">
        <div class="span6">
          <label>Land phone</label>
          <%= default_contact.text_field :contact_no_telephone, :class => 'span12' %>
        </div>
        <div class="span6">
          <label>Mobile phone</label>
          <%= default_contact.text_field :contact_no_mobile, :class => 'span12' %>
        </div>
      </div>
      <div class="row-fluid">
        <div class="span6">
          <label>Email</label>
          <%= default_contact.text_field :email, :class => 'span12' %>
        </div>
        <div class="span6">
          <label>Fax no</label>
          <%= default_contact.text_field :fax_no, :class => 'span12' %>
        </div>
      </div>
      <% end %>
      </fieldset>
    </div>
  </div>
  <div class="form-actions">
    <%= f.submit nil, :class => 'btn btn-primary' %>
    <%= link_to 'Cancel', drivers_path, :class => 'btn' %>
  </div>
  <% end %>
</div>